Repository navigation
ignition: set USE_NODE_PRIORITY flag on exported CUDA graphs - #581
lukealonso merged 1 commit into
Conversation
voipmonitor
left a comment
There was a problem hiding this comment.
Review & Live SM120 CUDA Test Report (commit 61f64f18)
Verdict: Request changes — end-to-end Heliopause/Helios wiring is already in place (flags & !9 == 0, kernel-node attribute id = 8 CU_LAUNCH_ATTRIBUTE_PRIORITY, forward- and backward-compatible with existing cores) and the live SM120 CUDA export test passes, but two items need attention before merge.
Automated & Live SM120 CUDA Test Results
- CPU
pytest -q tests/preparation/test_capture_graph_metadata.py— 12 passed, 0 failed. - Live SM120 CUDA
FLARE_RUN_CUDA_TESTS=1 pytest -q tests/preparation/test_recorded_export_graph_cuda.py— 1 passed (3.29s), confirming realcuGraphExecGetFlagsDriver API FFI andflags_by_name == {"decode": 9, "tune": 1}.
Findings
- [Major] Qualify live exported-core
flare runbehavior (docs/design-review.mdPrinciple 12):
EnablingCUDA_GRAPH_INSTANTIATE_FLAG_USE_NODE_PRIORITYglobally activates CTA-level preemption for every kernel captured onScratchArena.auxiliary_stream(ignition/preparation/scratch.py:83-105) across all recipes. That is desirable for small TP collectives, but any recipe launching heavy compute onauxiliary_streamcould see scheduling regressions. Please verify with an end-to-end exported TP core served viaflare run(and ideally add a Helios load+replay check assertingcuGraphExecGetFlags == 9on the Helios-instantiated executable). - [Major]
record_export_graphdoes not validatekeep_graph=False/_flare_graph_metadatagraphs (ignition/preparation/runtime_core.py:208-242):
record_export_graphcallsinstantiate_graph(graph)(which supports_flare_graph_metadata/keep_graph=False) and then unconditionally setsgraph._flare_instantiation_flags = prior_flags | instantiation_flags. If a caller passes akeep_graph=Falsegraph,record_export_graphsucceeds and fails later in_graphs()/ Heliopause (graph=0). Wheninstantiation_flags is not None, validate up front thatgetattr(graph, "_flare_graph_metadata", None) is Noneandint(graph.raw_cuda_graph()) != 0. Also consider clearing any pre-existing_flare_instantiation_flagswheninstantiation_flags=None. - [Minor] PR description inaccuracies (Principle 16):
- States "rejecting unsupported bits on either source before mutating graph state" — for
prior_flags,graph.retain_object(...)andinstantiate_graph(graph)have already run before_executable_instantiation_flags(graph)is checked. - States "Passing
instantiation_flags=Nonekeeps executable-derived flags for startup tuning graphs" — startup tuning graphs do not callrecord_export_graphat all (they callcapture_graph+instantiate_graph).
- States "rejecting unsupported bits on either source before mutating graph state" — for
- [Nit] Reuse
PERMITTED_CUDA_GRAPH_INSTANTIATE_FLAGSin_graphs()(runtime_core.py:279) instead of hardcodingflags & ~9, and lazily cache_Cuda()instead of reopeninglibcuda.so.1per graph.
|
A case file has been opened for 581. Future reviews will auto-run 90 minutes after code updates are pushed.
|
61f64f1 to
18312bd
Compare
|
@voipmonitor Addressed at
Could you take another look at |
Autobot ReviewFull Review · Value Proposition · Case File Recommendation: Changes RequestedThe downstream Heliopause/Helios pipeline already accepts
Have your agent review the Full Review for complete verified findings, To opt out, include |
Autobot ReviewFull Review · Value Proposition · Case File Recommendation: Changes RequestedRevision
Walkthrough
Merge Risk: Medium · up to
|
voipmonitor
left a comment
There was a problem hiding this comment.
Re-reviewed 18312bd0 — all Round 1 Python/Rust correctness, validation, and Helios-wiring items are cleanly resolved!
- Pre-mutation validation in
record_export_graphcleanly rejectskeep_graph=False,_flare_graph_metadata, andraw_cuda_graph() == 0beforeretain_object/instantiate_graph, andinstantiation_flags=Noneclears stale_flare_instantiation_flags. _cuda_driver()caching andPERMITTED_CUDA_GRAPH_INSTANTIATE_FLAGSreuse in_graphs()look great.- Great addition of
node_priority_tests.rs(CUPTIcuGraphInstantiateWithFlagsexit callback confirmingflags=9/1on live HeliosNativeResources::load,CU_LAUNCH_ATTRIBUTE_PRIORITYattributes, and0-ULPReplayWorkerparity).
Only remaining gate (Principle 12): Because this enables USE_NODE_PRIORITY (8) globally by default on every exported serving graph (activating CTA preemption for all kernels captured on ScratchArena.auxiliary_stream across all recipes), we still need a live served-workload A/B measurement on flare run (flags=1 vs flags=9 on a real TP core) confirming zero regression across decode/prefill overlap before merging (or gate it behind an explicit opt-in if full multi-recipe qualification isn't ready yet).
18312bd to
7fc5993
Compare
|
@voipmonitor Thanks for the review! We took the explicit opt-in option in 7fc5993 (rebased onto origin/main 44f59df) so default exported cores stay completely unchanged until full multi-recipe lare run A/B qualification is done:
Could you please take another look at 7fc5993? |
voipmonitor
left a comment
There was a problem hiding this comment.
Verified opt-in --use-node-priority revision 7fc5993b on top of origin/main (44f59df5) plus full live 4× RTX PRO 6000 Blackwell (SM120) TP4 exported-core flare run paired ABAB qualification (flags=1 vs flags=9).
1. Unit, Rust & Live SM120 CUDA/CUPTI Verification (7fc5993b)
- Clean opt-in CLI/config wiring:
use_node_prioritydefaults toFalse(flags=1), cleanly threaded throughconfig.py,parameters.py,planning.py,serve.py,host_ranks.py,rank_group.py,tuning.py(export_node_prioritycontextvar),capture.py, andruntime_core.py; properly rejected onignition benchandignition debug-serve. - CPU pytest (
tests/cli/test_{commands,config,parameters}.py+tests/preparation/...): 161 passed, 14 skipped, 0 failed. - Rust
runtime_core:cargo test --locked --release --manifest-path helios/Cargo.toml --features runtime-core,server --lib runtime_core— 185 passed, 0 failed, 11 ignored. - Live SM120 CUDA + Helios CUPTI Replay (GPU 4):
FLARE_RUN_CUDA_TESTS=1 pytest tests/preparation/test_recorded_export_graph_cuda.py— 2 passed, 0 failed (verifying defaultflags=1vs opt-inflags=9via CUPTIcuGraphInstantiateWithFlagsand bit-exactReplayWorkerreplay).
2. Live 4× SM120 TP4 Exported-Core flare run Paired ABAB Qualification (flags=1 vs flags=9)
Exported two apples-to-apples DeepSeek-V4.1-Flash TP4 cores (--max-concurrency 32 --image-concurrency 4 --mtp-draft-tokens 7 --mtp-only --row-shard-prefill --row-shard-attention --autotune-effort default, Core B reusing Core A's weights), differing solely in serving graph flags:
- Core manifest verification: Exact match across all 4 ranks —
135/135graphs,9,728kernels/rank,91/135graphs containing43,290priority=-5(auxiliary_stream) kernels; Core A recordedflags=1on135/135, Core B recordedflags=9on135/135. - Paired ABAB (
A1 → B1 → A2 → B2, RAM Engram,C=32, MTP-7):- Stability & qualification: 0 errors, 0 hangs, 0 CUDA faults, identical VRAM (
79.47 GiBweights/rank,59.8 GiBKV); Greedy17*23=3914/4 PASS, 4× Vision 16/16 PASS, Cold NIAH8K–128K16/16 PASS. - Cold prefill (
8K–128K, warm-GPUA2vsBmean): flat parity within-0.30%to+0.23%(64K:59.9k → 59.9k,128K:59.4k → 59.4k). - Decode GPU step latency (mean across paired ABAB):
C=1:5.719 → 5.631 ms(-1.54%)C=4 @ P=256:7.247 → 7.125 ms(-1.68%,B4xW8:7.68 → 7.29 ms,-5.08%)C=8 @ P=256:8.683 → 8.721 ms(+0.44%,B8xW8:9.31 → 9.08 ms,-2.47%)C=16 @ P=256:10.482 → 10.464 ms(-0.17%,B16xW8:15.24 → 14.42 ms,-5.38%)C=32 @ P=256:13.172 → 13.009 ms(-1.24%)C=32 @ P=2048:13.268 → 13.071 ms(-1.48%,1,232.0 → 1,232.8 tok/s)
- Stability & qualification: 0 errors, 0 hangs, 0 CUDA faults, identical VRAM (
Clean, safe opt-in design with real multi-GPU hardware qualification — ready to merge.
Why:
Exported serving graphs that capture overlapped work on higher-priority CUDA
streams such as `ScratchArena.auxiliary_stream` record per-kernel
`CU_LAUNCH_ATTRIBUTE_PRIORITY` attributes, but CUDA ignores kernel-node
priorities during replay unless the graph executable is instantiated with
`CU_GRAPH_INSTANTIATE_FLAG_USE_NODE_PRIORITY` (`8`). Recording
`USE_NODE_PRIORITY` alongside permitted flags already present on the captured
executable (`CUDA_GRAPH_INSTANTIATE_FLAG_AUTO_FREE_ON_LAUNCH`, `1` -> `9`)
enables Helios to honor captured stream priorities during
`cuGraphInstantiateWithFlags`. Requesting explicit instantiation flags also
requires a retained CUDA graph template (`keep_graph=True` without
post-instantiation release metadata) so export rejects missing or released
templates before handing a zero template handle to Heliopause.
What:
- `ignition/preparation/runtime_core.py`:
- Before: `record_export_graph` retained owners and instantiated the graph
without serializing `USE_NODE_PRIORITY`, so exported serving graphs kept
only executable-derived flags (`1`).
- After: `record_export_graph` defaults `instantiation_flags` to
`CUDA_GRAPH_INSTANTIATE_FLAG_USE_NODE_PRIORITY` (`8`). When
`instantiation_flags` is not `None`, it validates the bitmask against
`PERMITTED_CUDA_GRAPH_INSTANTIATE_FLAGS` (`9`, bits `1` and `8`), rejects
graphs carrying `_flare_graph_metadata` or a released/zero
`raw_cuda_graph()` handle, and verifies pool ownership before calling
`retain_object` or `instantiate_graph`. After instantiation, it clears any
pre-existing `_flare_instantiation_flags` attribute, queries
`cuGraphExecGetFlags` through a lazily cached `_Cuda` driver wrapper,
rejects unsupported executable flags, and records
`prior_flags | instantiation_flags`. Passing `instantiation_flags=None`
clears any prior `_flare_instantiation_flags` override so export falls back
to executable-derived or recorded graph metadata. `_graphs` reuses
`PERMITTED_CUDA_GRAPH_INSTANTIATE_FLAGS` and rejects zero
`raw_cuda_graph()` handles when `_flare_instantiation_flags` is set.
- `helios/src/runtime_core/` (`format.rs`, `mod.rs`, `node_priority_tests.rs`),
`helios/tests/node_priority_core_fixture.py`, and `tests/preparation/`
(`test_capture_graph_metadata.py`, `test_recorded_export_graph_cuda.py`,
`test_runtime_core.py`):
- Helios runtime loading already validates `flags & !9 == 0` and passes
serialized flags to `cuGraphInstantiateWithFlags`. Add Rust validation
coverage, Python CPU unit tests for template-retention guards,
pre-mutation rejection, stale-flag clearing, `_Cuda` caching, and
zero-template rejection, plus a signed-core CUDA fixture and Helios
`NativeResources::load` + `ReplayWorker` test verifying via CUPTI that
`cuGraphInstantiateWithFlags` receives `9` on the serving graph and `1` on
the startup tuning graph with bit-exact main- and auxiliary-stream replay.
- Compatibility: Existing signed cores keep their recorded graph flags (`1`)
and load and serve without re-export or re-signing. Startup tuning graphs
continue to call `capture_graph` and `instantiate_graph` directly
(`flags = 1`).
Result:
Newly exported serving graphs instantiate with `USE_NODE_PRIORITY` (`8`,
combined with `AUTO_FREE_ON_LAUNCH` -> `9`) while startup tuning graphs keep
`flags = 1` and existing signed cores remain compatible. In paired ABAB
multi-GPU `flare run` serving qualification by `@voipmonitor` (review
`PRR_kwDOVRNQZM8AAAABa9GF4Q`) on `4x NVIDIA RTX PRO 6000 Blackwell` (SM120)
with `DeepSeek-V4.1-Flash` TP4 (`flags = 1` vs `flags = 9` across `135/135`
graphs, `91/135` containing `43,290` `priority = -5` auxiliary-stream kernels),
`flags = 9` produced zero errors, hangs, or CUDA faults, identical VRAM
(`79.47 GiB` weights/rank, `59.8 GiB` KV), 4/4 greedy, 16/16 vision, and 16/16
cold NIAH (`8K-128K`) passes, flat cold prefill (`-0.30%` to `+0.23%`), and
decode GPU step latency reductions of `-1.24%` to `-1.68%` at `C=1`, `C=4`, and
`C=32` (with wide `W=8` speculative buckets `B4xW8`, `B8xW8`, and `B16xW8`
improving `-2.47%` to `-5.38%`, and `C=8`/`C=16` overall means at
`+0.44%`/`-0.17%`). That multi-GPU A/B used the equivalent `flags = 9` core
manifest generated by commit `7fc5993b`; recipes other than
`DeepSeek-V4.1-Flash` and architectures other than SM120 were outside that
serving A/B scope.
Evidence:
- Verified on a clean `git archive` extraction with freshly built
`flare_heliopause` on WSL2 Linux with `1x NVIDIA GeForce RTX 5090` (SM120):
- `ruff==0.12.8 check` on the 5 touched Python files: passed.
- `cargo test --locked --release --manifest-path helios/Cargo.toml --features runtime-core,server --lib runtime_core::`: 186 passed, 0 failed, 11 ignored.
- `pytest -v -rs tests/preparation/test_core_boundary.py tests/test_design_review_hook.py tests/preparation/test_capture_graph_metadata.py tests/preparation/test_runtime_core.py`: 57 passed, 14 skipped (CUDA-gated tests in `test_runtime_core.py`), 0 failed.
- `FLARE_RUN_CUDA_TESTS=1 CUDA_VISIBLE_DEVICES=0 pytest -v -rs tests/preparation/test_recorded_export_graph_cuda.py`: 2 passed, 0 skipped, 0 failed (verifying `flags_by_name == {"decode": 9, "tune": 1}`, negative auxiliary-stream kernel priority, CUPTI-observed `cuGraphInstantiateWithFlags` flags `9` on `"decode"` and `1` on `"tune"`, retained `cuGraphExecGetFlags == 1`, and bit-exact `ReplayWorker` main- and auxiliary-stream outputs).
- Multi-GPU serving A/B evidence: `@voipmonitor` review `PRR_kwDOVRNQZM8AAAABa9GF4Q`
on `4x NVIDIA RTX PRO 6000 Blackwell` (SM120) TP4 `DeepSeek-V4.1-Flash`
(`flags = 1` vs `flags = 9`, paired ABAB, `135/135` graphs).
- Limitations: Single-GPU SM120 runtime-core export, CUPTI instantiation-flag
verification, and `ReplayWorker` replay ran directly on this commit; multi-GPU
`flare run` serving A/B was performed by `@voipmonitor` on `DeepSeek-V4.1-Flash`
TP4 (SM120) on the equivalent `flags = 9` manifest at `7fc5993b`, leaving
other recipes and SM103/SM121 serving A/B outside the measured scope.
Discord: Dooner
Design-Signed-Off-By: Antigravity (Gemini 4 Neon); design-review=2e5b
Signed-off-by: FujitsuPolycom <87842395+FujitsuPolycom@users.noreply.github.com>
7fc5993 to
4270e90
Compare
|
Updated PR #581 to
Could you take another look at |
Autobot ReviewFull Review · Value Proposition · Case File Recommendation: Ready To MergeHead
Walkthrough
Merge Risk: Medium · up to
|
Why
Exported serving graphs that capture overlapped work on higher-priority CUDA streams such as
ScratchArena.auxiliary_streamrecord per-kernelCU_LAUNCH_ATTRIBUTE_PRIORITYattributes, but CUDA ignores kernel-node priorities during replay unless the graph executable is instantiated withCU_GRAPH_INSTANTIATE_FLAG_USE_NODE_PRIORITY(8). RecordingUSE_NODE_PRIORITYalongside permitted flags already present on the captured executable (CUDA_GRAPH_INSTANTIATE_FLAG_AUTO_FREE_ON_LAUNCH,1->9) enables Helios to honor captured stream priorities duringcuGraphInstantiateWithFlags. Requesting explicit instantiation flags also requires a retained CUDA graph template (keep_graph=Truewithout post-instantiation release metadata) so export rejects missing or released templates up front instead of passing a zero template handle to Heliopause.What
ignition/preparation/runtime_core.py):record_export_graphretained owners and instantiated the graph without serializingUSE_NODE_PRIORITY, so exported serving graphs recorded only executable-derived flags (1).record_export_graphdefaultsinstantiation_flagstoCUDA_GRAPH_INSTANTIATE_FLAG_USE_NODE_PRIORITY(8). Wheninstantiation_flagsis notNone, it validates the bitmask againstPERMITTED_CUDA_GRAPH_INSTANTIATE_FLAGS(9, bits1and8), rejects graphs carrying_flare_graph_metadataor a released/zeroraw_cuda_graph()handle, and checks pool ownership before callingretain_objectorinstantiate_graph. After instantiation, it clears any pre-existing_flare_instantiation_flagsattribute, queriescuGraphExecGetFlagsthrough a lazily cached_Cudadriver wrapper, rejects unsupported executable flags, and recordsprior_flags | instantiation_flags. Passinginstantiation_flags=Noneclears any prior_flare_instantiation_flagsoverride so export falls back to executable-derived or recorded graph metadata._graphsreusesPERMITTED_CUDA_GRAPH_INSTANTIATE_FLAGSand rejects zeroraw_cuda_graph()handles whenever_flare_instantiation_flagsis set.helios/src/runtime_core/,helios/tests/node_priority_core_fixture.py,tests/preparation/):flags & !9 == 0and forwards serialized flags tocuGraphInstantiateWithFlags. Add a Rust validation unit test (format.rs), Python CPU unit tests covering template-retention guards, pre-mutation rejection, stale-flag clearing,_Cudacaching, and zero-template rejection, and a signed-core CUDA fixture plus HeliosNativeResources::load+ReplayWorkertest verifying via CUPTI thatcuGraphInstantiateWithFlagsreceives9on the serving graph (decode) and1on the startup tuning graph (tune), alongside0-ULPbit-exact main- and auxiliary-stream replay.1) and continue to load and serve without re-export or re-signing. Startup tuning graphs continue to callcapture_graphandinstantiate_graphdirectly (flags = 1).Result
Newly exported serving graphs instantiate with
USE_NODE_PRIORITY(8, combined withAUTO_FREE_ON_LAUNCH->9) while startup tuning graphs retainflags = 1and previously signed cores remain loadable without changes.In paired ABAB multi-GPU
flare runserving qualification by@voipmonitor(review) on4x NVIDIA RTX PRO 6000 Blackwell(SM120) servingDeepSeek-V4.1-FlashTP4 (flags = 1vsflags = 9across135/135graphs,91/135graphs containing43,290priority = -5auxiliary-stream kernels):0errors,0hangs,0CUDA faults; identical VRAM (79.47 GiBweights/rank,59.8 GiBKV); greedy4/4PASS, vision16/16PASS, cold NIAH (8K-128K)16/16PASS.8K-128K): flat parity within-0.30%to+0.23%(64K:59.9k -> 59.9k,128K:59.4k -> 59.4k).C=1:5.719 -> 5.631 ms(-1.54%)C=4 @ P=256:7.247 -> 7.125 ms(-1.68%;B4xW8:7.68 -> 7.29 ms,-5.08%)C=8 @ P=256:8.683 -> 8.721 ms(+0.44%;B8xW8:9.31 -> 9.08 ms,-2.47%)C=16 @ P=256:10.482 -> 10.464 ms(-0.17%;B16xW8:15.24 -> 14.42 ms,-5.38%)C=32 @ P=256:13.172 -> 13.009 ms(-1.24%)C=32 @ P=2048:13.268 -> 13.071 ms(-1.48%,1,232.0 -> 1,232.8 tok/s)That multi-GPU A/B was collected on the equivalent
flags = 9core manifest produced by commit7fc5993b; recipes other thanDeepSeek-V4.1-Flashand architectures other than SM120 were outside that serving A/B scope.Evidence
Verified on a clean
git archiveextraction of commit4270e9046dab222981d8d8bcc80cbcb1a2843bda(rebased ontoorigin/main9a054b49) on WSL2 Linux with1x NVIDIA GeForce RTX 5090(SM120) and freshly builtflare_heliopause:ruff==0.12.8 checkon the 5 touched Python files: passed.cargo test --locked --release --manifest-path helios/Cargo.toml --features runtime-core,server --lib runtime_core::: 186 passed, 0 failed, 11 ignored.pytest -v -rs tests/preparation/test_core_boundary.py tests/test_design_review_hook.py tests/preparation/test_capture_graph_metadata.py tests/preparation/test_runtime_core.py: 57 passed, 14 skipped (CUDA-gated tests intest_runtime_core.py), 0 failed.FLARE_RUN_CUDA_TESTS=1 CUDA_VISIBLE_DEVICES=0 pytest -v -rs tests/preparation/test_recorded_export_graph_cuda.py: 2 passed, 0 skipped, 0 failed — verifyingflags_by_name == {"decode": 9, "tune": 1}, negative auxiliary-stream (< 0) and main-stream (0) serialized kernel priorities, CUPTI-observedcuGraphInstantiateWithFlagsflags9on"decode"and1on"tune", retainedcuGraphExecGetFlags == 1, and bit-exactReplayWorkermain- and auxiliary-stream outputs.ReplayWorkerreplay ran directly on4270e9046dab222981d8d8bcc80cbcb1a2843bda; multi-GPUflare runserving A/B was performed by@voipmonitoronDeepSeek-V4.1-FlashTP4 (SM120) using the equivalentflags = 9manifest at7fc5993b, leaving other recipes and SM103/SM121 serving A/B outside the measured scope.Discord: Dooner